
#include <sstream>
#include "cmd_obj.h"
#include "cgi_stub_cntl.h"
#include "storageao_stub4web.h"
#include "storageao_req_resp.h"


using namespace erp::storage::ao;

	uint32_t CStorageAoStub4Web::AddDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CDisassembleBillPo& DisassembleBillInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve,
				uint64_t& DisassembleBillSysNo
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoAddDisassembleBillReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.DisassembleBillInfo = DisassembleBillInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
			oReq.DisassembleBillSysNo = DisassembleBillSysNo;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_ADDDISASSEMBLEBILL_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_ADDDISASSEMBLEBILL_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoAddDisassembleBillResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
			DisassembleBillSysNo  = oResp.DisassembleBillSysNo;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::AddLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CLoseBillPo& LoseBillInfo,
				const erp::storage::po::COverFlowBillPo& OverFlowBillInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve,
				uint64_t& OverFlowBillSysNo
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoAddLoseBillOrOverFlowBillReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.LoseBillInfo = LoseBillInfo;
			oReq.OverFlowBillInfo = OverFlowBillInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
			oReq.OverFlowBillSysNo = OverFlowBillSysNo;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_ADDLOSEBILLOROVERFLOWBILL_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_ADDLOSEBILLOROVERFLOWBILL_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoAddLoseBillOrOverFlowBillResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
			OverFlowBillSysNo  = oResp.OverFlowBillSysNo;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::AddStock(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CStockPo& StockInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve,
				uint64_t& StockSysNo
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoAddStockReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.StockInfo = StockInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
			oReq.StockSysNo = StockSysNo;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_ADDSTOCK_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_ADDSTOCK_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoAddStockResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
			StockSysNo  = oResp.StockSysNo;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::AddStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CStockCheckMasterPo& StockCheckMasterInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve,
				uint64_t& StockCheckMasterSysNo
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoAddStockCheckReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.StockCheckMasterInfo = StockCheckMasterInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
			oReq.StockCheckMasterSysNo = StockCheckMasterSysNo;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_ADDSTOCKCHECK_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_ADDSTOCKCHECK_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoAddStockCheckResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
			StockCheckMasterSysNo  = oResp.StockCheckMasterSysNo;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::DeleteDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& DisassemblebillSysNos,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoDeleteDisassembleBillReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.DisassemblebillSysNos = DisassemblebillSysNos;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.errorCode = errorCode;
			oReq.errorMsg = errorMsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_DELETEDISASSEMBLEBILL_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_DELETEDISASSEMBLEBILL_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoDeleteDisassembleBillResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::DeleteLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& FLoseBillSysNo,
				const std::set<uint64_t >& FOverFlowBillSysNo,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoDeleteLoseBillOrOverFlowBillReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.FLoseBillSysNo = FLoseBillSysNo;
			oReq.FOverFlowBillSysNo = FOverFlowBillSysNo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.errorCode = errorCode;
			oReq.errorMsg = errorMsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_DELETELOSEBILLOROVERFLOWBILL_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_DELETELOSEBILLOROVERFLOWBILL_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoDeleteLoseBillOrOverFlowBillResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::DeleteStock(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& FStockSysNo,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoDeleteStockReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.FStockSysNo = FStockSysNo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.errorCode = errorCode;
			oReq.errorMsg = errorMsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_DELETESTOCK_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_DELETESTOCK_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoDeleteStockResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::DeleteStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& StockCheckMasterSysNos,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoDeleteStockCheckReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.StockCheckMasterSysNos = StockCheckMasterSysNos;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.errorCode = errorCode;
			oReq.errorMsg = errorMsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_DELETESTOCKCHECK_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_DELETESTOCKCHECK_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoDeleteStockCheckResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetDisassembleBillBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const std::set<uint64_t >& DisassembleBillSysnoList,
				const std::string& inReserve,
				std::string& errmsg,
				std::vector<erp::storage::po::CDisassembleBillPo >& DisassembleBillList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetDisassembleBillBySysNosReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.DisassembleBillSysnoList = DisassembleBillSysnoList;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.DisassembleBillList = DisassembleBillList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETDISASSEMBLEBILLBYSYSNOS_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETDISASSEMBLEBILLBYSYSNOS_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetDisassembleBillBySysNosResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			DisassembleBillList  = oResp.DisassembleBillList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetDisassembleBillList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::storage::po::CDisassembleBillFilterPo& DisassembleBillFilter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::storage::po::CDisassembleBillPo >& DisassembleBillList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetDisassembleBillListReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.DisassembleBillFilter = DisassembleBillFilter;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.total = total;
			oReq.DisassembleBillList = DisassembleBillList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETDISASSEMBLEBILLLIST_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETDISASSEMBLEBILLLIST_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetDisassembleBillListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			DisassembleBillList  = oResp.DisassembleBillList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetLoseBillOrOverFlowBillBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const std::set<uint64_t >& LoseBillSysNoList,
				const std::set<uint64_t >& OverFlowSysNoList,
				const std::string& inReserve,
				std::string& errmsg,
				std::vector<erp::storage::po::CLoseBillPo >& LoseBillList,
				std::vector<erp::storage::po::COverFlowBillPo >& OverFlowList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetLoseBillOrOverFlowBillBySysNosReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.LoseBillSysNoList = LoseBillSysNoList;
			oReq.OverFlowSysNoList = OverFlowSysNoList;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.LoseBillList = LoseBillList;
			oReq.OverFlowList = OverFlowList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETLOSEBILLOROVERFLOWBILLBYSYSNOS_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETLOSEBILLOROVERFLOWBILLBYSYSNOS_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetLoseBillOrOverFlowBillBySysNosResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			LoseBillList  = oResp.LoseBillList;
			OverFlowList  = oResp.OverFlowList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetLoseBillOrOverFlowBillList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::storage::po::COverFlowBillOrLoseBillFilterPo& OverFlowBillOrLoseBillFilter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::storage::po::CLoseBillPo >& LoseBillList,
				std::vector<erp::storage::po::COverFlowBillPo >& OverFlowList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetLoseBillOrOverFlowBillListReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.OverFlowBillOrLoseBillFilter = OverFlowBillOrLoseBillFilter;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.total = total;
			oReq.LoseBillList = LoseBillList;
			oReq.OverFlowList = OverFlowList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETLOSEBILLOROVERFLOWBILLLIST_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETLOSEBILLOROVERFLOWBILLLIST_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetLoseBillOrOverFlowBillListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			LoseBillList  = oResp.LoseBillList;
			OverFlowList  = oResp.OverFlowList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetStockBranch_RelBySysNo(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				uint64_t StockSysNo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve,
				std::vector<erp::storage::po::CStockBranch_RelPo >& StockBranchList
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetStockBranch_RelBySysNoReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.StockSysNo = StockSysNo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
			oReq.StockBranchList = StockBranchList;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETSTOCKBRANCH_RELBYSYSNO_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETSTOCKBRANCH_RELBYSYSNO_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetStockBranch_RelBySysNoResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
			StockBranchList  = oResp.StockBranchList;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetStockBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const std::set<uint64_t >& StockSysnoList,
				const std::string& inReserve,
				std::string& errmsg,
				std::vector<erp::storage::po::CStockPo >& StockList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetStockBySysNosReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.StockSysnoList = StockSysnoList;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.StockList = StockList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETSTOCKBYSYSNOS_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETSTOCKBYSYSNOS_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetStockBySysNosResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			StockList  = oResp.StockList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetStockCheckBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const std::set<uint64_t >& StockCheckMasterSysNoList,
				const std::string& inReserve,
				std::string& errmsg,
				std::vector<erp::storage::po::CStockCheckMasterPo >& StockCheckList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetStockCheckBySysNosReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.StockCheckMasterSysNoList = StockCheckMasterSysNoList;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.StockCheckList = StockCheckList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETSTOCKCHECKBYSYSNOS_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETSTOCKCHECKBYSYSNOS_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetStockCheckBySysNosResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			StockCheckList  = oResp.StockCheckList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetStockCheckList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::storage::po::CStockCheckFilterPo& StockCheckFilterPo,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::storage::po::CStockCheckMasterPo >& StockCheckList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetStockCheckListReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.StockCheckFilterPo = StockCheckFilterPo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.total = total;
			oReq.StockCheckList = StockCheckList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETSTOCKCHECKLIST_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETSTOCKCHECKLIST_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetStockCheckListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			StockCheckList  = oResp.StockCheckList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::GetStockList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::storage::po::CStockFilterPo& StockFilter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::storage::po::CStockPo >& StockList,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoGetStockListReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.StockFilter = StockFilter;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.total = total;
			oReq.StockList = StockList;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_GETSTOCKLIST_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_GETSTOCKLIST_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoGetStockListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			StockList  = oResp.StockList;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::ModifyStockBranch_Rel(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				uint64_t StockSysNo,
				const std::set<uint64_t >& BranchSysNos,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoModifyStockBranch_RelReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.StockSysNo = StockSysNo;
			oReq.BranchSysNos = BranchSysNos;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_MODIFYSTOCKBRANCH_REL_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_MODIFYSTOCKBRANCH_REL_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoModifyStockBranch_RelResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::UpdataDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CDisassembleBillPo& DisassembleBillInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoUpdataDisassembleBillReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.DisassembleBillInfo = DisassembleBillInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_UPDATADISASSEMBLEBILL_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_UPDATADISASSEMBLEBILL_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoUpdataDisassembleBillResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::UpdataLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CLoseBillPo& LoseBillInfo,
				const erp::storage::po::COverFlowBillPo& OverFlowBillInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoUpdataLoseBillOrOverFlowBillReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.LoseBillInfo = LoseBillInfo;
			oReq.OverFlowBillInfo = OverFlowBillInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_UPDATALOSEBILLOROVERFLOWBILL_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_UPDATALOSEBILLOROVERFLOWBILL_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoUpdataLoseBillOrOverFlowBillResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::UpdataStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CStockCheckMasterPo& StockCheckMasterInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoUpdataStockCheckReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.StockCheckMasterInfo = StockCheckMasterInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_UPDATASTOCKCHECK_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_UPDATASTOCKCHECK_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoUpdataStockCheckResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CStorageAoStub4Web::UpdateStock(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::storage::po::CStockPo& StockInfo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CStorageAoUpdateStockReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.StockInfo = StockInfo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;

		// oCgiStubCntl.setRouteKey(uint32_t routeKey); 娌℃湁璁剧疆routeKey  
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
	    if((iRetCode = oCgiStubCntl.putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed:";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(STORAGEAO_UPDATESTOCK_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << STORAGEAO_UPDATESTOCK_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CStorageAoUpdateStockResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}

